import json

import requests
cookir = requests.session()
class Hdjg:
#username=lisi&password=e10adc3949ba59abbe56e057f20f883e;100  登录都改这样
    def Dl(self,cr):
        url = 'http://localhost:90/login/verifyLogin'
        cs = cr#类似让 ; -->  +'='+
        rp=cookir.get(url,params=cs)#获得了一个最终返回的cookie
        return  rp

    def Zc(self,username,yhm,password,mm,dc,z):
# username;zcy;password;e10adc3949ba59abbe56e057f20f883e;100;;
        url ='http://localhost:90/login/register'
        cs={
            username:yhm,
            password:mm,
            dc:z
        }
        zx=cookir.post(url,data=cs)
        return zx

    def Xggrxx(self,id,cr):#登录调用上面的Dl
# username;zcy&password=e10adc3949ba59abbe56e057f20f883e;7;realname=%E9%83%9&idcard=51372&paypwd=666666&phone=15&email=1q.com;100
        url=f'http://localhost:90/user/updateUserProfile/{id}'
        cs=cr
        zx=cookir.put(url,data=cs)
        return zx

    def Gmm(self,cr):#先调用之前的参数
# username=hxw&password=f379eaf3c831b04de153469d1bec345e;id=12&oldpwd=f3799dc345e&newpwd=e1883e;100
        url='http://localhost:90/user/updatePwd'
        cs=cr
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.put(url,data=cs,headers=head)
        return zx
    #把hxw密码改为123456
    def Mryhk(self,id):#需调用登录
#username=hxw&password=f379eaf3c831b04de153469d1bec345e;8;100
        url=f'http://localhost:90/user/personal/toBankCardDefault.html/{id}'
        zx=cookir.post(url)
        return zx

    def Tjyhk(self,cr):
        url='http://localhost:90/user/addBankCard'
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.post(url,data=cr,headers=head)
        return zx

    def Wd(self,cr):
#username=smdmy&password=e10adc3949ba59abbe56e057f20f883e;amount=111&term=11&rate=0.1500;500
        url='http://localhost:90/user/applyLoan'
        cs=cr
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.post(url,data=cs,headers=head)
        return zx

    def Jjlc(self,cr):
#lisi&password=e10adc3949ba59abbe56e057f20f883e;fundProductId=3&userId=1&passWord=666666;100 加一个username=
        url='http://localhost:90/user/buyFundProduct'
        cs=cr
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.post(url,data=cs,headers=head)
        return zx

    def Qxlc(self,cr):
        url='http://localhost:90/user/buyTermFinancial'
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.post(url,data=cr,headers=head)
        return zx

    def Lqlc(self,cr):
        url='http://localhost:90/user/userBuyChangeMoney'
        head={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
        zx=cookir.post(url,data=cr,headers=head)
        return zx















